package com.czy.config;


import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;

import java.io.IOException;

/**
 * redisson 配置类
 * Created on 2018/6/19
 */
@Configuration
public class RedissonConfig {


    @Bean
    public RedissonClient redisson() throws IOException {
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://114.55.126.232:6379");
        RedissonClient redisson = Redisson.create(config);


//        RedissonClient redisson = Redisson.create(
//                Config.fromYAML(new ClassPathResource("redisson-single.yml").getInputStream()));


        return redisson;
    }
}